import React from 'react'
import { Panel, Cell, CellBody, CellsTitle, CellFooter, Cells } from 'react-weui'

export default class ProductDetails extends React.Component {
	constructor(props) {
		super(props)
		this.state = {
			detailImage: []
		}
	}
	componentWillReceiveProps(nextProps) {
		if(nextProps.goodData !== undefined) {
			this.setState({
				detailImage: nextProps.goodData.detailImage
			})
		}
	}
	render() {
		const picStyle = {
            width: '100%'
		};
		const { detailImage } = this.state;
	    return (
		    <Panel>
                <CellsTitle>图文详情</CellsTitle>
                <Cells style={{ fontSize: '0.9em' }}>
                {
                	detailImage.map(function(item, i) {
						return (
							<Cell key={i}>
	                    		<img 
	                    			style={picStyle} 
	                    			src={`http://${item.image}`} 
	                    		/>
	                		</Cell>
						)
                	})
                }       
                </Cells>
           </Panel>
		);
	}
}
